package com.tledu.day62springboot.controller;

import com.shangyun.ShangyunStringUtils;
import com.sy.Shangyun2;
import com.tledu.day62springboot.core.CustomException;
import com.tledu.day62springboot.entity.DateTest;
import com.tledu.day62springboot.other.TestService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author cyrus
 */
@RestController
@AllArgsConstructor
public class HelloController {

    private final TestService testService;

    private final ShangyunStringUtils shangyunStringUtils;

    private final Shangyun2 shangyun2;

    @GetMapping("/hello")
    public String hello() {
        throw new CustomException(400, "参数错误");
//        return "Hello World。。。。。。";
    }


    @PostMapping("/date/json")
    public DateTest dateTest(@RequestBody DateTest dateTest) {
        return dateTest;
    }

    @PostMapping("/date/form")
    public DateTest dateTest2(DateTest dateTest) {
        return dateTest;
    }

}
